(async function getData() {
    // Vue.createApp({
    //     data() {
    //         return {
    //             addData: []
    //         }
    //     }
    // })
    //this.addData.splice(0,this.addData.length)
    //this.addData.length = 0
    await axios.get('http://127.0.0.1:9094/getSum', {}).then((response) => {
        var res = response.data;
        console.log(res)
        var chinaMap = echarts.init(document.getElementById('myMap'))
        var option = {
            tooltip:{
               formatter: function (arg) {
                   return arg.name+'：'+arg.value
               }
            },
            geo: {
                map: "china",
                roam: true,
                zoom: 1.25,
                itemStyle: {
                    areaColor: "#fff",
                    borderColor: "#666",
                    borderWidth: "0.3",
                    opacity: 1
                },
                label: {
                    show: true,
                    fontSize: 10
                },
                emphasis: {
                    itemStyle: {
                        areaColor: "yellow"
                    }
                },
                select:{
                    itemStyle: {
                        areaColor: "yellow"
                    }
                }
            },
            series: [{
                type: "map",
                geoIndex: 0,
                data: res
            }],
            visualMap: {
                type: 'piecewise',
                pieces: [
                    {min: 0, max: 0, label: '0', color: '#fff'},
                    {min: 1, max: 30, label: '1-30', color: '#87CEFA'},
                    {min: 31, max: 60, label: '31-60', color: '#1E90FF'},
                    {min: 61, max: 90, label: '61-90', color: '#6A5ACD'},
                    {min: 91, max: 120, label: '91-120', color: '#BA55D3'},
                    {min: 121, max: 150, label: '121-150', color: '#8A2BE2'},
                    {min: 151, max: 160, label: '151-160', color: '#00CED1'},
                    {min: 161, max: 170, label: '161-170', color: '#4682B4'}
                ],
                itemWidth: 10,
                itemHeight: 10,
                itemGap: 2,
                inverse: false,
                textStyle:{
                    color:'#fff'
                }

            }
        }
        chinaMap.setOption(option)
    })
})()
